package stack_queue.queue.impl;

import bin_tree.heap.MaxHeap;
import stack_queue.queue.Queue;

/**
 * 基于最大堆实现的优先级队列
 * @author yuisama
 * @date 2022/01/07 20:54
 **/
public class PriorityQueue implements Queue {
    private MaxHeap heap = new MaxHeap();
    @Override
    public void offer(int value) {
        heap.add(value);
    }

    @Override
    public int poll() {
        return heap.extractMax();
    }

    @Override
    public int peek() {
        return heap.peekHeap();
    }
}